﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 设计模式.过滤器模式
{
    public class CriteriaSingle : ICriteria
    {
        public List<Person> MeetCriteria(List<Person> persons)
        {
            List<Person> singlePersons = new();
            foreach (var person in persons)
            {
                if (person.MaritalStatus?.Equals("single", StringComparison.OrdinalIgnoreCase) == true)
                {
                    singlePersons.Add(person);
                }
            }
            return singlePersons; 
        }
    }
}
